﻿using UnityEngine;
using System.Collections;

public class EOTitem {

	// Use this for initialization

	public ScoreKeeper thescorekeeper;
	public float waittime;
	public bool save;
	public bool kill;
	public bool setfire;
	public Soundman soundman;
	public int soundnum;
	public House house;
	public bool already;

	public EOTitem(float cwaittime, bool csave, bool ckill, bool csetfire, Soundman csoundman, int csoundnum, House chouse,ScoreKeeper cscore)
	{
		waittime = cwaittime;
		save = csave;
		kill = ckill;
		setfire = csetfire;
		soundman = csoundman;
		soundnum = csoundnum;
		house = chouse;
		thescorekeeper = cscore;
		already = false;


	}


	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
	
	}

	public void runitem()
	{

		if(save)
		{
			if(house.occupantsno >0)
			{
				house.occupantsno--;
				house.UpdateOccs();
				soundman.playsound(4);
				thescorekeeper.updateScore(1);
			}
			//graphic
		}

		if(kill)
		{
			if(house.occupantsno >0) house.occupantsno--;
			house.UpdateOccs();
			soundman.playsound(3);
			thescorekeeper.updateDeaths(1);
			//graphic
		}

		if(setfire)
		{
			house.startFire();
			soundman.playsound(6);
			//graphic
		}



	}

}
